<link rel="stylesheet" href="/public/js/kindEditer/themes/default/default.css"/>
<link rel="stylesheet" href="/public/js/validate/jquery.validator.css"/>
<script charset="utf-8" src="/public/js/jquery.min.js"></script>
<script charset="utf-8" src="/public/js/kindEditer/kindeditor-all-min.js"></script>
<script charset="utf-8" src="/public/js/validate/jquery.validator.js"></script>
<script charset="utf-8" type="text/javascript" src="/public/js/validate/local/zh_CN.js"></script>
<div class="ym-column ">
    <div class="ym-fbox">
        <form action="/{{.Path}}" method="post" class="ym-form" id="addform" name="addform">
            <div class="ym-g960-1">
                <label for="title">标题： </label>
            </div>
            <div class="msg-box" for="title"
                 style="display:inline-block; text-align: right;float: right"></div>
            <div class="ym-clearfix"></div>
            <div>
                <input name="title" id="title" type="text" data-rule="标题:required;length[1~50]" class="ym-inline">
            </div>

            <label for="description">简介：
                <div class="msg-box" for="description"
                     style="text-align: right"></div>
            </label>
            <textarea name="description" id="description" data-rule="简介:required;length[4~]" rows="5"></textarea>
            <label for="content">内容：

            </label>

            <div style="width: 100px;float: right;text-align: left"><span class="msg-box" for="content"></span>
            </div>
            <textarea name="content" id="content" data-rule="内容:required;length[10~]" rows="30"></textarea>

            <div class="ym-fbox-footer ym-fbox-button center">
                <input type='submit' class="save ym-primary" value="提交"/>
            </div>
            <div class="ym-clearfix"></div>
        </form>
    </div>
</div>

<script>
    var editor;
    KindEditor.ready(function (K) {
        editor = K.create('#content', {
            width : '600px',
            allowFileManager: true,
            afterBlur: function () {
                //编辑器失去焦点时直接同步，可以取到值
                this.sync();
                $('#content').trigger("validate");

            }
        });
    });

    $("#addform").validator({
        beforeSubmit: function () {
            editor.sync();
        }
    });
</script>